Northwoods.GoWPF 2.2.4 Assembly
TreeModelNodeData<NodeKey> Class
Members 

the Type of a value uniquely identifying a node data in the model
A simple representation of node data for TreeModel<NodeType,NodeKey> that supports property change notification, copying, and undo via the INotifyPropertyChanged, ICloneable, and IChangeDataValue interfaces.
Syntax
Type Parameters
NodeKey
the Type of a value uniquely identifying a node data in the model
Remarks

This provides a standard implementation of TreeModel<NodeType,NodeKey> data that represents nodes and includes a property for referring to the "parent" node, and a property for holding a list of "children" nodes. You can use this class if you do not already have your own application class holding information about nodes and if you want to inherit from an existing class so that you can just add your own properties. Here's a simple example:

[Serializable] public class MyData : TreeModelNodeData<String> { public MyData() { } public String Name { get { return _Name; } set { if (_Name != value) { String old = _Name; _Name = value; RaisePropertyChanged("Name", old, value); } } } private String _Name; public String Address { get { return _Address; } set { if (_Address != value) { String old = _Address; _Address = value; RaisePropertyChanged("Address", old, value); } } } private String _Address; }

Note that property setters need to raise the model's Changed event, so that the model knows about changes in the data and can then update the diagram. You should call RaisePropertyChanged only when the value has actually changed, and you should pass both the previous and the new values, in order to support undo/redo.

For both Silverlight and WPF you should override the Clone method if the fields contain data that should not be shared between copies. For WPF the properties that you define should also be serializable, in order for the data to be copiable, especially to and from the clipboard.

If you add properties to this node data class, and if you are using the TreeModel<NodeType,NodeKey>.Save<NodeDataType> and TreeModel<NodeType,NodeKey>.Load<NodeDataType> methods, you should override the MakeXElement and LoadFromXElement methods to add new attributes and/or elements as needed,

Normally, each Key should have a unique value within the model. You can maintain that yourself, by setting the Key to unique values before adding the node data to the model's collection of nodes. Or you can ensure this by overriding the TreeModel<NodeType,NodeKey>.MakeNodeKeyUnique method. The override (or the setting of the same-named delegate in TreeModel<NodeType,NodeKey>.Delegates) is required if nodes might be copied within the model.

If you want each node to keep a reference to its "parent" node, you can use the ParentKey property. If you want each node to keep a list of reference to its "children" nodes, you can use the ChildKeys property, which is a list of node keys. You can use both ParentKey and ChildKeys at the same time.

Inheritance Hierarchy

System.Object
   Northwoods.GoXam.Model.TreeModelNodeData<NodeKey>

Requirements
See Also

Reference

TreeModelNodeData<NodeKey> Members
Northwoods.GoXam.Model Namespace

 

 


© Northwoods Software 2017. All Rights Reserved.

Send Feedback